package org.bits.ui;

import java.awt.*;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ScrollableOkCancelDialog
{
    private OkCancelDialog dialog;

    public ScrollableOkCancelDialog( Window owner, String title, Component panel )
    {
        JPanel scrollPanel = new JPanel( new GridBagLayout() );
        JScrollPane scrollPane = new JScrollPane( scrollPanel );
        GridBagConstraints constraints;

        scrollPane.setBorder( null );

        constraints = new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 4,
                4, 4, 4 ), 0, 0 );
        scrollPanel.add( panel, constraints );

        dialog = new OkCancelDialog( owner, title, scrollPane );
    }

    /***************************************************************************
     * @param width
     * @param height
     **************************************************************************/
    public void setSize( int width, int height )
    {
        dialog.setSize( width, height );
    }

    /***************************************************************************
     * @param v
     **************************************************************************/
    public void setValidates( boolean v )
    {
        dialog.setValidates( v );
    }

    /***************************************************************************
     * @return
     **************************************************************************/
    public boolean showDialogView()
    {
        return dialog.showDialogView();
    }
}
